feat: matrix ci - #2014
Conversation
WalkthroughTwo GitHub Actions workflows were restructured to use a two-job pattern: per-architecture native builds (amd64, arm64) followed by multi-arch manifest creation for Docker Hub and GHCR. The Dockerfile was updated to support cross-architecture builds via TARGETOS/TARGETARCH with explicit GOOS/GOARCH defaults and separated ENV settings. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant GA as GitHub Actions
participant BldA as build_single_arch (amd64)
participant BldR as build_single_arch (arm64)
participant Hub as Docker Hub
participant GHCR as GHCR
participant Man as create_manifests
Dev->>GA: Push tag (refs/tags/...)
GA->>BldA: Start native build (linux/amd64)
GA->>BldR: Start native build (linux/arm64)
rect rgba(200,230,255,0.3)
note right of BldA: Shallow checkout, tag/version resolve,<br/>normalize GHCR repo, metadata
BldA->>Hub: Push image (amd64 tags)
BldA->>GHCR: Push image (amd64 tags)
end
rect rgba(200,230,255,0.3)
note right of BldR: Shallow checkout, tag/version resolve,<br/>normalize GHCR repo, metadata
BldR->>Hub: Push image (arm64 tags)
BldR->>GHCR: Push image (arm64 tags)
end
GA-->>Man: needs: build_single_arch (both arch builds complete)
alt Tag build (refs/tags/*)
Man->>Hub: Create/push multi-arch manifests<br/>(versioned, latest/alpha)
Man->>GHCR: Create/push multi-arch manifests<br/>(versioned, latest/alpha)
else Non-tag
note over Man: Skipped by workflow condition
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/docker-image-alpha.yml(1 hunks).github/workflows/docker-image-arm64.yml(2 hunks)Dockerfile(1 hunks)
| - name: Create & push manifest (GHCR - version) | ||
| run: | | ||
| docker buildx imagetools create \ | ||
| -t ghcr.io/${GHCR_REPOSITORY}:${TAG} \ | ||
| ghcr.io/${GHCR_REPOSITORY}:${TAG}-amd64 \ | ||
| ghcr.io/${GHCR_REPOSITORY}:${TAG}-arm64 | ||
|
|
||
| - name: Create & push manifest (GHCR - latest) | ||
| run: | | ||
| docker buildx imagetools create \ | ||
| -t ghcr.io/${GHCR_REPOSITORY}:latest \ | ||
| ghcr.io/${GHCR_REPOSITORY}:latest-amd64 \ | ||
| ghcr.io/${GHCR_REPOSITORY}:latest-arm64 |
There was a problem hiding this comment.
Define GHCR_REPOSITORY before creating manifests.
create_manifests runs in a fresh job, so GHCR_REPOSITORY is empty here. As a result, commands like docker buildx imagetools create -t ghcr.io/${GHCR_REPOSITORY}:${TAG} expand to ghcr.io/:${TAG}, which fails and stops the release. Recompute the repository name in this job before the GHCR steps.
create_manifests:
name: Create multi-arch manifests (Docker Hub + GHCR)
needs: [build_single_arch]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Extract tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
+
+ - name: Normalize GHCR repository
+ run: echo "GHCR_REPOSITORY=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Create & push manifest (GHCR - version) | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${GHCR_REPOSITORY}:${TAG} \ | |
| ghcr.io/${GHCR_REPOSITORY}:${TAG}-amd64 \ | |
| ghcr.io/${GHCR_REPOSITORY}:${TAG}-arm64 | |
| - name: Create & push manifest (GHCR - latest) | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${GHCR_REPOSITORY}:latest \ | |
| ghcr.io/${GHCR_REPOSITORY}:latest-amd64 \ | |
| ghcr.io/${GHCR_REPOSITORY}:latest-arm64 | |
| create_manifests: | |
| name: Create multi-arch manifests (Docker Hub + GHCR) | |
| needs: [build_single_arch] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Extract tag | |
| run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| - name: Normalize GHCR repository | |
| run: echo "GHCR_REPOSITORY=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV | |
| - name: Create & push manifest (GHCR - version) | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${GHCR_REPOSITORY}:${TAG} \ | |
| ghcr.io/${GHCR_REPOSITORY}:${TAG}-amd64 \ | |
| ghcr.io/${GHCR_REPOSITORY}:${TAG}-arm64 | |
| - name: Create & push manifest (GHCR - latest) | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${GHCR_REPOSITORY}:latest \ | |
| ghcr.io/${GHCR_REPOSITORY}:latest-amd64 \ | |
| ghcr.io/${GHCR_REPOSITORY}:latest-arm64 |
Summary by CodeRabbit
New Features
Chores